﻿CREATE TABLE [dbo].[Arhive] (
    [CodArhiva]   SMALLINT     IDENTITY (1, 1) NOT NULL,
    [Denumire]    VARCHAR (50) NOT NULL,
    [CodUnitate]  SMALLINT     CONSTRAINT [DF_Arhive_CodUnitate] DEFAULT ((0)) NOT NULL,
    [DataInceput] DATETIME     NULL,
    [DataSfarsit] DATETIME     NULL,
    [Anul]        SMALLINT     CONSTRAINT [DF_Arhive_Anul] DEFAULT ((2000)) NOT NULL,
    [BalCon]      BIT          CONSTRAINT [DF_Arhive_BalCon] DEFAULT ((0)) NULL,
    [Fares]       BIT          CONSTRAINT [DF_Arhive_Fares] DEFAULT ((0)) NULL,
    [Luna]        SMALLINT     DEFAULT ((0)) NOT NULL,
    [ResUma]      BIT          DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_Arhive] PRIMARY KEY CLUSTERED ([CodArhiva] ASC),
    CONSTRAINT [FK_Arhive_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);


GO
CREATE NONCLUSTERED INDEX [IX_Anul_CodUnit]
    ON [dbo].[Arhive]([Anul] ASC, [CodUnitate] ASC);

